import { createApp } from 'vue'
import router, { setupRouter } from './router';

import { setupNaiveDiscreteApi } from "@/utils/naiveDiscreteApi"

import { setupStore } from '@/store';

import 'virtual:windi.css'
import App from './App.vue'

async function bootstrap() {
    const app = createApp(App);
    // 挂载状态管理
    setupStore(app);
    
    // 挂载 naive-ui 脱离上下文的 Api
    setupNaiveDiscreteApi();

    // 挂载路由
    await setupRouter(app);

    // 路由准备就绪后挂载APP实例
    await router.isReady();
    app.mount('#app', true);
}

void bootstrap();
